﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SerialPorts;
using System.Windows.Forms;
using DataCollector.Entity;

namespace EnergyControl_SeverDlg
{
    public partial class EnergyControl_sever
    {
        public void StartMonitor(string portName)
        {
            sph.StartMontior(portName);
            timer1.Enabled = true;
        }

        private void OnMonitorAction(MonitorResult message)
        {
            lock (msgQueue.SyncRoot)
            {
                msgQueue.Enqueue(message);
            }
        }

        private void EndMonitor()
        {
            if (sph != null)
            {
                sph.EndMontior();
            }
            timer1.Enabled = false;
        }
    }
}
